package com.igeekhome.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.igeekhome.biz.ICommonWordService;
import com.igeekhome.pojo.CommonWord;
import com.igeekhome.pojo.CustomerService;
import com.igeekhome.pojo.SessionMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 * 常见的用语 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-03-16
 */
@Controller
@RequestMapping("/commonWord")
public class CommonWordController {

    @Autowired
    private ICommonWordService iCommonWordService;

    @RequestMapping("/cl")
    public String reply(Model model, CommonWord commonWord, HttpSession session) {


        List<CommonWord> replyList = this.iCommonWordService.list();
        model.addAttribute("replyList", replyList);


        return "Commonlanguage";
    }


    @RequestMapping("/addcl")
    public String addcl(CommonWord commonWord, Model model, HttpSession session) {
        CommonWord c = new CommonWord(commonWord.getLib(), commonWord.getContent(), commonWord.getType());
        System.out.println("添加常用语成功");
        this.iCommonWordService.save(c);
        return "Commonlanguage";
    }


}

